#!/bin/bash

#ipcs
#ipcrm

USUARIO=`whoami`

#echo "Deteniendo procesos..."
#kill `ps -e | grep 7574 | cut -d' ' -f2` 2&> /dev/null
#kill `ps -e | grep 7574 | cut -d' ' -f1` 2&> /dev/null

echo "Limpiando memorias compartidas..."
for i in  `ipcs -m | grep -v ^0x00000000 | grep $USUARIO | cut -f2 -d' '`
do
   ipcrm -m $i
done

echo "Limpiando semaforos..."
for i in  `ipcs -s | grep -v ^0x00000000 | grep $USUARIO | cut -f2 -d' '`
do
   ipcrm -s $i
done

echo "Limpiando colas..."
for i in  `ipcs -q | grep -v ^0x00000000 | grep $USUARIO | cut -f2 -d' '`
do
   ipcrm -q $i
done

